<form action="" class="form-horizontal" role="form">
  
  <div class="form-group">
    <label class="col-sm-2 control-label">商品名称</label>
    <div class="col-sm-4">
      <input type="text" class="form-control" name="name" placeholder="请输入商品名称" datatype="*" value="{$grouponGoods.name}">
    </div>
  </div>
  
  <div class="form-group">
    <label class="col-sm-2 control-label">商品图片地址</label>
    <div class="col-sm-6">
      <input type="text" class="form-control margin-bottom" name="pic" id="pic" datatype="*" placeholder="请上传商品图片" value="{$grouponGoods.pic}">
      <input type="file" name="file_upload" id="image_upload">
    </div>
  </div>
  
  <div class="form-group">
    <label class="col-sm-2 control-label">商品原价</label>
    <div class="col-sm-2">
      <input type="text" class="form-control" name="price" placeholder="输入价格信息" value="{$grouponGoods.price}">
    </div>
  </div>
  
  <div class="form-group">
    <label class="col-sm-2 control-label">团购价</label>
    <div class="col-sm-2">
      <input type="text" class="form-control" name="groupon_price" placeholder="输入价格信息" value="{$grouponGoods.groupon_price}">
    </div>
  </div>
  
  <div class="form-group">
    <label class="col-sm-2 control-label">商品内容</label>
    <div class="col-sm-6">
      <textarea class="form-control" name="description" rows="5" id="txtContent">{$grouponGoods.description}</textarea>
    </div>
  </div>
  
  <div class="form-group">
    <div class="col-sm-offset-2 col-sm-8">
      <a class="btn btn-default" onclick="javascript:history.go(-1)">返回上页</a>
      <a class="btn btn-default" onclick="self.location=document.referrer">返回上页并刷新</a>
      <input type="hidden" name="id" value="{$grouponGoods.id}">
      <input type="hidden" name="gid" value="{$gid}">
      <button type="submit" class="btn btn-primary submit" data-loading-txt="提交中，请稍后……" data-ajax-url="__CONTROLLER__/save">保存更改</button>
    </div>
  </div>
</form>

<!-- uploadify -->
<link rel="stylesheet" href="__PUBLIC__/Style/Common/uploadify/uploadify.css">
<script src="__PUBLIC__/Style/Common/uploadify/jquery.uploadify.min.js?{:rand(0,9999)}"></script>
<script type="text/javascript">
$(function() {
  $("#image_upload").uploadify({
    'multi'      :  false,
    'fileSizeLimit'    :  '200kb',
    'buttonText'       :  '选择图片',
    'fileTypeDesc'     :  'Image Files',
    'fileTypeExts'     :  '*.jpg; *.png',
    'swf'              :  '__PUBLIC__/Style/Common/uploadify/uploadify.swf',
    'uploader'         :  '__MODULE__/Upload/uploadOne',
    'onUploadSuccess'  :  function(data, res){
      var url = eval("(" + res + ")").extra.url;
      $("#pic").val( url );
    }
  });
});
</script>